草庐IT

cell 手势

全部标签

ios - SWRevealViewController 平移手势识别器问题

我正在使用John-Lluch的SWRevealViewController。我需要使用平移手势来查看侧边栏,并且我正在使用滑动来查看我的上一篇和下一篇文章。但是,只能检测到平移手势。更新:如果我禁用平移手势,我的滑动手势就会起作用。平移手势[self.viewaddGestureRecognizer:self.revealViewController.panGestureRecognizer];滑动手势UISwipeGestureRecognizer*left=[[[UISwipeGestureRecognizeralloc]initWithTarget:selfaction:@se

ios - 将 UIView 添加到单元格与 cell.contentView 的优缺点是什么?

我有一个UITableViewCell。我应该如何向它添加subview?我见过很多将subview添加到contentView的示例,但为什么不直接添加到cell呢? 最佳答案 你可以这样做,但是如果你想通过添加自定义View来自定义单元格,你应该将它们添加到contentView以便让它们沿着表格动画动画 关于ios-将UIView添加到单元格与cell.contentView的优缺点是什么?,我们在StackOverflow上找到一个类似的问题: htt

ios - UICollectionView cell doselect翻转动画,View丢失

didSelect方法上的UICollectionView单元格翻转动画应该翻转并显示有关单击的索引单元格的详细信息,如果用户想要转到原始View,应该能够在单元格上看到。我正在使用UICollectionViewCell*cell=[collectionViewcellForItemAtIndexPath:indexPath];[UIViewanimateWithDuration:1.0delay:0options:(UIViewAnimationOptionAllowUserInteraction)animations:^{[UIViewtransitionFromView:cel

ios - 解决两个平移手势识别器之间的冲突

我有以下层次结构:查看subview每个View都分配有UIPanGestureRecognizer。外部平移手势识别器只对垂直平移感兴趣,因此我为此实现了委托(delegate)方法:-(BOOL)gestureRecognizerShouldBegin:(UIPanGestureRecognizer*)panGestureRecognizer{CGPointvelocity=[panGestureRecognizervelocityInView:panGestureRecognizer.view];returnfabs(velocity.y)>fabs(velocity.x);}然

ios - TableView 选择和平移手势

我有一个带有平移手势的表格View。当我开始上下平移tableview时,tableView选择被禁用,我无法选择tableview单元格。UIPanGesture*tablePanGesture=[[UIPanGestureRecognizeralloc]initWithTarget:selfaction:@selector(gestureHandler:)];tablePanGesture.delegate=self;[tableViewaddGestureRecognizer:tablePanGesture];[tablePanGesturesetCancelsTouchesIn

ios - 如何在滑动手势上获取 IndexPath 和 UItableView

我有一个UITableView,我在其中添加了UISwipeGesture,如下所示:-(UITableViewCell*)tableView:(UITableView*)tableViewcellForRowAtIndexPath:(NSIndexPath*)indexPath{CustomCell*cell=(CustomCell*)[tableViewdequeueReusableCellWithIdentifier:kCellIndetifier];UISwipeGestureRecognizer*gestureR;gestureR=[[UISwipeGestureRecogn

ios - 如何在 UITableView Cell 中以编程方式创建 n 个 UIButton?

我正在尝试创建一个带有n个按钮的UITableView,具体取决于后端JSON数据。我附上了一张图片,我知道如何在UITableViewCell上创建UIButton,但我不知道如何将它们正确放置在UITableViewCell中。UIButtonUITableViewCellUIButton*continuebtn=[[UIButtonalloc]initWithFrame:CGRectMake(10,100,view1.frame.size.width-20,40)];[continuebtnsetBackgroundColor:[UIColorgrayColor]];[conti

ios - 启用旁白功能的手势识别器

我开发了一个应用程序,允许用户在Canvas上绘制他的手指签名。此功能是使用UIPanGestureRecognizer实现的,具有特定的目标操作以在UIView中画一条线,但是当“画外音”处于事件状态时,不再触发手势识别器操作。手势初始化代码UIPanGestureRecognizer*pan=[[UIPanGestureRecognizeralloc]initWithTarget:selfaction:@selector(pan:)];pan.maximumNumberOfTouches=pan.minimumNumberOfTouches=1;[selfaddGestureRec

iOS:将手势传递给下面的 View

我有一个简单的设置:有2个兄弟UIViewsA和B,B完全覆盖A(但它是透明的,所以A是可见的):┌──────────────────┐│ViewA││││┌──────────────┴───┐││ViewB││││││││││││││││└───┤│││││└──────────────────┘我需要2个不同的UIGestureRecognizers:A应该有一个点击识别器,B应该有一个平移识别器。每当我点击B时,它应该将触摸事件传递给后面的ViewA,以便它可以识别点击(我将使用一些逻辑来了解平移是否被接受,例如距离、开始区域等)。这可以在iOS中实现吗?到目前为止,我的经验

ios - 使用手势识别器中的选择器从 GameScene 调用另一个类中的 SpriteKit 函数

我在Laser.swift中有一个shootLaser函数,它是一个独立于GameScene的文件。我正在尝试使用点击手势识别器来发射激光,但我在语法方面遇到了问题。Laser.swift中的函数是:funcshootLaser(_sender:UITapGestureRecognizer,parentNode:SKNode,spriteNode:SKSpriteNode){letlaser=SKSpriteNode(imageNamed:"laserBlast")parentNode.addChild(laser)laser.position=CGPoint(x:spriteNode